//create a new instance of Services_JSON 
<?php require_once('JSON.php'); 
$json = new Services_JSON();

// convert a complex value to JSON notation
$value = array(1, 2, 'foo');
$output = $json->encode($value);
print($output);

// accept incoming POST data 
$input = $GLOBALS['HTTP_RAW_POST_DATA']; 
$value = $json->decode($input); 
?>